const mockList = [
    {id:1,name:"tom",age:19},
    {id:2,name:"jerry",age:22},
    {id:3,name:"peter",age:12},
    {id:4,name:"tomas",age:51},
    {id:5,name:"tim",age:31},
    {id:6,name:"frank",age:18},
    {id:7,name:"rose",age:22}
]

export default [
    {
        url: '/api/getAllUsers',
        method: 'get',
        response: ({ body }) => {
            console.log('body>>>', body)
            return {
                code: 0,
                message: 'ok',
                data: ['tom','jerry']
            }
        }
    },
    {
        url:'/api/getUsers',
        method:'get',
        response:(config)=>{
            //提取参数
            const {page=1,limit=5} = config.query;
            //分页
            const data = mockList.filter((item,index)=>{
                index<limit * page && index>= limit * (page-1)
            })
            return {
                code:0,
                data,
                total:mockList.length
            }
        }
    }
]